//
//  AssetHeaderView.m
//  PlayCatchGame
//
//  Created by 流言 on 2018/2/6.
//  Copyright © 2018年 清正. All rights reserved.
//

#import "AssetHeaderView.h"


@interface AssetHeaderView()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *title_btn_space;
@property (copy, nonatomic) ButtonBlock rechargeBlock;

@end

@implementation AssetHeaderView

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setMoneyType:(NSInteger)moneyType {
    if (_moneyType !=moneyType) {
        _moneyType =moneyType;
        
        if (moneyType ==1) {
            self.titleLabel.text =@"金豆";
            self.rechargeBtn.hidden =NO;
            [self.rechargeBtn setTitle:@"充值" forState:UIControlStateNormal];
            self.contentLabel.hidden =YES;
            self.title_btn_space.constant =20;
        } else if (moneyType ==2) {
            self.titleLabel.text =@"现金红包";
            self.rechargeBtn.hidden =NO;
            self.contentLabel.hidden =NO;
            [self.rechargeBtn setTitle:@"提现" forState:UIControlStateNormal];
            self.contentLabel.text =@"满50可提现";
            self.title_btn_space.constant =20;
        } else if (moneyType ==3) {
            self.titleLabel.text =@"总收益";
            self.rechargeBtn.hidden =YES;
            self.contentLabel.hidden =NO;
            self.contentLabel.text =@"收益将自动放入红包";
            self.title_btn_space.constant =-28;
        }
    }
}
- (IBAction)buttonClick:(UIButton *)sender {
    if (self.rechargeBlock) {
        self.rechargeBlock(sender);
    }
}

- (void)didRechargeButtonBlock:(ButtonBlock)newBlock {
    self.rechargeBlock =newBlock;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
